package com.beidu.lottery.call.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 活动类型枚举
 */
@Getter
@AllArgsConstructor
public enum ActivityTypeEnum {

    REG(0, "reg", "报名活动"),
    VOTE(1, "vote","投票活动"),
    LOTTERY(2, "lottery","抽奖活动"),
    // TODO 扩展
    ;

    /**
     * code
     */
    private final Integer code;

    /**
     * type
     */
    private final String type;

    /**
     * name
     */
    private final String name;

    /**
     * 匹配code是否包含在当前枚举中
     *
     * @param code 枚举code
     * @author 北渡
     */
    public static boolean contains(Integer code) {
        for (ActivityTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }

}
